package com.panshi.controller;

import com.panshi.api.api.AnswerAuditHDPort;
import com.panshi.api.bean.AnswerAuditHDBean;
import com.panshi.api.util.PageSizeVO;
import com.panshi.pojo.AnswerAuditHDVO;
import com.panshi.servers.AnswerAuditHDServers;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author XiaoWangYa
 * @version 1.0
 * @date 2020/8/10 0010 上午 10:44
 */
@Slf4j
@Controller
@Api("回答未审核Controller层")
public class AnswerAuditHDController implements AnswerAuditHDPort {

    @Autowired
    private AnswerAuditHDServers answerAuditHDServers;

    @Override   // 新增回答审核数据
    public void addAnswerAuditHDInfo(@RequestBody AnswerAuditHDBean answerAuditHDBean) {
        answerAuditHDServers.addAnswerAuditHDInfo(answerAuditHDBean);
    }

    @Override   // 删除回答审核数据
    public void deleteAnswerAuditHDInfo(@PathVariable int id) {
        answerAuditHDServers.deleteAnswerAuditHDInfo(id);
    }

    @Override   // 查询指定问答下未审核回答 and 指定用户回答未审核数据
    public PageSizeVO queryAssignAuditHDQuestionAnswerInfo(@RequestBody PageSizeVO pageSizeHDBean) {
        // 获取指定起始下标
        pageSizeHDBean.setStartIndex(pageSizeHDBean.getStartIndexInfo());
        // 返回数据
        PageSizeVO page = new PageSizeVO();
        page.setData(answerAuditHDServers.queryAssignAuditHDQuestionAnswerInfo(pageSizeHDBean));
        return page;
    }

    @Override   // 修改回答审核
    public void updateAnswerAuditHDInfo(@RequestBody AnswerAuditHDBean answerAuditHDBean) {
        answerAuditHDServers.updateAnswerAuditHDInfo(answerAuditHDBean);
    }
}
